package aiguigu2.two;

/**
 * ClassName: aiguigu2.two.ArrayExer01
 * Package: PACKAGE_NAME
 * Description:
 *
 * @Author ZY
 * @Create 2024/9/12 11:57
 * @Version 1.0
 */
public class ArrayExer01 {
    public static void main(String[] args) {
        //初始化数组:静态初始化
        int[][] arr =new int[][]{{3,5,8},{12,9},{7,8,6,4}};
        //不建议动态初始化
        /*int[][] arr = new int[3][];
        *arr[0] = new int[3];
        * arr[0][0] = 3;
        * ...
        */
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            for (int j =0; j < arr[i].length; j++){
                sum += arr[i][j];
            }
        }
        System.out.println("sum:" + sum);


    }
}
